//
//  XHF_MineViewController.m
//  haojia
//
//  Created by 徐宏飞 on 16/4/11.
//  Copyright © 2016年 徐宏飞. All rights reserved.
//

#import "XHF_MineViewController.h"

#import "XHF_MineHeaderView.h"
#import "XHF_GoingProjectTV.h"
#import "XHF_AppointmentTV.h"
#import "XHF_MaterialTV.h"
#import "XHF_Solution.h"
#import "XHF_HorizontalPagingView.h"

@interface XHF_MineViewController ()



@end

@implementation XHF_MineViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    XHF_MineHeaderView *headerView = [XHF_MineHeaderView headerView];
    
    //正在进行的项目
    XHF_GoingProjectTV *goingPor = [XHF_GoingProjectTV GoingProjectTableView];
    
    //我预约的工人
    XHF_AppointmentTV *appointment = [XHF_AppointmentTV AppointmentTableView];
    
    //我选购的材料清单
    XHF_MaterialTV *material = [XHF_MaterialTV MaterialTableView];
    
    //我收到的答案
    XHF_Solution *solution = [XHF_Solution SolutionTableView];
    
    
    //buttons
    UIButton *goingPorBTN = [self createButtonWithNormalImg:@"btn_nor" SelectedImg:@"btn_hl" Title:@"正在进行\n的项目"];
    UIButton *appointmentBTN = [self createButtonWithNormalImg:@"btn_nor" SelectedImg:@"btn_hl" Title:@"我预约\n的工人"];
    UIButton *materialBTN = [self createButtonWithNormalImg:@"btn_nor" SelectedImg:@"btn_hl" Title:@"我选购\n的材料"];
    UIButton *solutionBTN = [self createButtonWithNormalImg:@"btn_nor" SelectedImg:@"btn_hl" Title:@"我收到的\n答案"];
    
    
   CGRect frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-109);
    //HorizontalPagingView
    XHF_HorizontalPagingView *pagingView = [XHF_HorizontalPagingView pagingViewWithHeaderView:headerView headerHeight:SCREEN_WIDTH*0.65  segmentButtons:@[goingPorBTN, appointmentBTN, materialBTN, solutionBTN] segmentHeight:40*WID contentViews:@[goingPor, appointment, material, solution] Frame:frame];
    
    
    [self.view addSubview:pagingView];
    
    
   
}

#pragma - 创建按钮
- (UIButton *)createButtonWithNormalImg:(NSString *)normalImg SelectedImg:(NSString *)selectedImg Title:(NSString *)title{
    
    UIButton *segmentButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [segmentButton setBackgroundImage:[UIImage imageNamed:normalImg] forState:UIControlStateNormal];
    [segmentButton setBackgroundImage:[UIImage imageNamed :selectedImg] forState:UIControlStateSelected];
    [segmentButton setTitle:title forState:UIControlStateNormal];
    [segmentButton setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
    [segmentButton setTitleColor:COLOR_SELECTED forState:UIControlStateSelected];
    segmentButton.titleLabel.font = [UIFont systemFontOfSize:14];
    segmentButton.titleLabel.numberOfLines=2;
    segmentButton.titleLabel.textAlignment = NSTextAlignmentCenter;
    return segmentButton;
}






- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
